<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<?php include("../../MerchandiseBay/conn.php"); ?>
<HTML 
xmlns="http://www.w3.org/1999/xhtml">


<?
$category="";
$kind="";
$regno="";
$comment="";

if(isset($_REQUEST['category']))
 {
  $category=$_REQUEST['category'];
  $kind=$_REQUEST['kind'];
  $regno=$_REQUEST['regno'];
  $comment=$_REQUEST['comment'];
  
  $whr="sold_date='00000000'";
  
  if($category!="")
    {$whr=$whr." and category like '%$category%'";}
    
  if(($kind!="")&&($whr==""))
    {$whr="kind like '%$kind%'";}
  if(($kind!="")&&($whr!=""))
    {$whr=$whr." and kind like '%$kind%'";}  
  //regno     
  if(($regno!="")&&($whr==""))
    {$whr="regno like '%$regno%'";}
  if(($regno!="")&&($whr!=""))
    {$whr=$whr." and regno like '%$regno%'";} 
    
  if(($comment!="")&&($whr==""))
    {$whr="comment like '%$comment%'";}
  if(($comment!="")&&($whr!=""))
    {$whr=$whr." and comment like '%$comment%'";} 
  
  if($whr=="")
     {$sqlMerchandise="select * from merchandise";}
   else  
    {$sqlMerchandise="select * from merchandise where $whr";}
  $qryMerchandise=mysql_query($sqlMerchandise,$conn);
  
 }
else{$search="none";}



?>
<HEAD>
<script language="javascript" type="text/javascript">

var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
win=window.open(mypage,myname,settings);}

</script>
<TITLE>Untitled Document</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<STYLE type=text/css>
BODY {
	COLOR: #ffff00
}
TD {
	COLOR: #ffff00
}
TH {
	COLOR: #ffff00
}
BODY {
	BACKGROUND-COLOR: #3366ff
}
</STYLE>
<META content="MSHTML 6.00.2900.2523" name=GENERATOR>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</HEAD>
<BODY>
<table border="0" width="97%" id="table1">
  <tr> 
    <td height="30" bgcolor="#FFFFFF"> <font size="4" face="Verdana"><strong> 
      <img src="icon/rss_48.png" width="29" height="32">&nbsp;<font color="#3366FF">Search 
      Your Favourite Product Here</font></strong></font></td>
  </tr>
  <tr> 
    <td width="70%" height="52" bordercolor="#FFFFFF" bgcolor="#330099"> <form method="POST" action="searchProduct.php">
        <p><font size="1">&nbsp;<font face="Verdana">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#FFFF00">&nbsp;<font face="Verdana">&nbsp;</font><strong>Category 
          : </strong></font> <strong><font color="#FFFF00"> 
          <input type="text" name="category" size="20" style="border:1px solid #333333; " value="<?=$category?>"></select> 
          &nbsp;<font color="#66FF00">Eg : Computer, Book... </font></font></strong></font></font> 
        </p>
        <p><font size="1"><strong><font color="#FFFF00" face="Verdana">&nbsp;&nbsp;&nbsp;&nbsp;<font face="Verdana">&nbsp;&nbsp;&nbsp;</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font face="Verdana">&nbsp;&nbsp;&nbsp;</font>&nbsp;<font face="Verdana">&nbsp;</font>Kind 
          : 
          <input type="text" name="kind" size="20" style="border:1px solid #333333; " value="<?=$kind?>">
          </font><font color="#66FF00" face="Verdana"><strong>Eg : Hardisk, Magazine... 
          </strong></font></strong></font></p>
        <p><font size="1"><strong><font color="#FFFF00" face="Verdana">&nbsp; Product </font><font size="1"><strong><font color="#FFFF00" face="Verdana">&nbsp;Code</font></strong></font><font color="#FFFF00" face="Verdana"> :
                <input name="regno" type="text" id="regno" style="border:1px solid #333333; " value="<?=$regno?>" size="20">
          </font><font face="Verdana"><strong><font color="#66FF00">Eg : C001, 
        B001, G001...</font></strong></font></strong></font></p>
        <p><font size="1"><strong><font color="#FFFF00" face="Verdana">&nbsp; 
          &nbsp;&nbsp;&nbsp;&nbsp;<font face="Verdana">&nbsp;</font>&nbsp;Key Word : 
          <input type="text" name="comment" size="20" style="border:1px solid #333333; " value="<?=$comment?>">
          </font><font face="Verdana"><strong><font color="#66FF00">Eg : Good, 
          Funny,...</font></strong></font></strong></font></p>
        <p><font face="Verdana">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
          &nbsp;&nbsp; 
          <input type="submit" value="   Search    " name="B1" style="font-family: Verdana; font-size: 12px; font-weight: bold">
          </font><font face="Verdana">
          <input type="reset" value="   Reset   " name="R" style="font-family: Verdana; font-size: 12px; font-weight: bold">
          </font></p>
      </form> </td>
  </tr>
  <tr> 
    <td> <table border="0" width="100%" id="table2">
        <?if(isset($_REQUEST['category'])) {?>
        <tr> 
          <td width="176" valign="top" bgcolor="#333333"><strong><font size="1" face="Verdana">Product Code 
          </font></strong></td>
          <td width="169" bgcolor="#333333" valign="top"><b> <font size="2" face="Verdana"><strong><font size="1" face="Verdana">Category</font></strong></font></b></td>
          <td width="162" bgcolor="#333333" valign="top"><div align="left"><font size="1"><strong><b><font face="Verdana">Kind</font></b></strong></font></div></td>
          <td width="295" bgcolor="#333333" valign="top"><div align="center"><font size="1"><b> 
              <font face="Verdana">Price</font></b></font></div></td>
          <td bgcolor="#333333" valign="top" width="126"><div align="center"><font size="1"><strong>Picture</strong></font></div></td>
        </tr>
        <? while($rowMerchandise=mysql_fetch_assoc($qryMerchandise)){?>
        <tr> 
          <td valign="top"><font face="Verdana" size="1" color="#FFFFFF">&nbsp;
            <?=$rowMerchandise['regno']?>
          </font></td>
          <td width="169" valign="top"> <font face="Verdana" size="1" color="#FFFFFF">&nbsp; 
            <?=$rowMerchandise['category']?>
            </font></td>
          <td width="162" valign="top"> <font size="1" face="Verdana" color="#FFFFFF"> 
            <?=$rowMerchandise['kind']?>
            </font></td>
          <td width="295" valign="top"> <font size="1" face="Verdana" color="#FFFFFF"> 
            <?=$rowMerchandise['price']?>
            </font></td>
          <td valign="top" width="126"> <div align="center"><font face="Verdana" size="1" color="#FFFFFF">&nbsp;<a href="productDetail.php?d=<?=$rowMerchandise['id']?>" onClick="NewWindow(this.href,'mywin','600','400','yes','center');return false" onFocus="this.blur()"><img src="productpic/<?=$rowMerchandise['pic']?>" alt="<?=$rowMerchandise['price']?>" border="1" hspace="7" vspace="2" width="89" height="69"></a></font></div></td>
        </tr>
        <?}
			if(mysql_num_rows($qryMerchandise)==0) {?>
        <tr> 
          <td colspan="5"> <p align="center"><b> <font size="3" face="Verdana" color="#FFFFFF">&nbsp;The 
              informatian of</font><font size="2" face="Verdana" color="#FF0000"> 
              <?=$category?>
              </font><font size="3" face="Verdana" color="#FFFFFF"> that you search 
              not found </font></b></td>
        </tr>
        <?}?>
      </table></td>
  </tr>
  <tr> 
    <td>&nbsp;</td>
  </tr>
</table>
<?}?>
</BODY></HTML>